NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. Things done in this patch: 1. Make __debug include __config since it uses macros from it. 2. The current method of defining _LIBCPP_ASSERT is prone to redefinitions. Move the null _LIBCPP_ASSERT definition into the __debug header to prevent this. 3. Remove external <__debug> include gaurds. <__debug> guards almost all of its contents internally. There is no reason to be doing it externally. This patch should not change any functionality. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215332 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__debug b/include/__debug index f1805ad..c151224 100644 --- a/include/__debug +++ b/include/__debug
@@ -11,19 +11,23 @@ #ifndef _LIBCPP_DEBUG_H #define _LIBCPP_DEBUG_H +#include <__config> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if _LIBCPP_DEBUG_LEVEL >= 1 - # include <cstdlib> # include <cstdio> # include <cstddef> # ifndef _LIBCPP_ASSERT # define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort())) # endif +#endif +#ifndef _LIBCPP_ASSERT +# define _LIBCPP_ASSERT(x, m) ((void)0) #endif #if _LIBCPP_DEBUG_LEVEL >= 2
diff --git a/include/__hash_table b/include/__hash_table index 4c4feb0..7c954b6 100644 --- a/include/__hash_table +++ b/include/__hash_table
@@ -20,11 +20,7 @@ #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header
diff --git a/include/algorithm b/include/algorithm index 4d064da..3ba104b 100644 --- a/include/algorithm +++ b/include/algorithm
@@ -638,6 +638,8 @@ #include <__undef_min_max> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif
diff --git a/include/experimental/optional b/include/experimental/optional index 3848da8..41d86b4 100644 --- a/include/experimental/optional +++ b/include/experimental/optional
@@ -151,11 +151,7 @@ #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header
diff --git a/include/experimental/string_view b/include/experimental/string_view index 3147e22..b0382e5 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view
@@ -182,6 +182,8 @@ #include <ostream> #include <iomanip> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif
diff --git a/include/iterator b/include/iterator index f338e01..88e615a 100644 --- a/include/iterator +++ b/include/iterator
@@ -338,11 +338,7 @@ #include <Availability.h> #endif -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header
diff --git a/include/list b/include/list index c36786d..13f8a53 100644 --- a/include/list +++ b/include/list
@@ -179,11 +179,7 @@ #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header
diff --git a/include/string b/include/string index d6c148a..fe72e9d 100644 --- a/include/string +++ b/include/string
@@ -453,6 +453,8 @@ #include <__undef_min_max> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif
diff --git a/include/unordered_map b/include/unordered_map index 4e2298b..0fa87d1 100644 --- a/include/unordered_map +++ b/include/unordered_map
@@ -351,6 +351,8 @@ #include <functional> #include <stdexcept> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif
diff --git a/include/unordered_set b/include/unordered_set index fd378fa..d06629f 100644 --- a/include/unordered_set +++ b/include/unordered_set
@@ -325,6 +325,8 @@ #include <__hash_table> #include <functional> +#include <__debug> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif
diff --git a/include/vector b/include/vector index 5d41bd1..1be584d 100644 --- a/include/vector +++ b/include/vector
@@ -276,11 +276,7 @@ #include <__undef_min_max> -#ifdef _LIBCPP_DEBUG -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header